//
//  FFNetCacheManager.m
//  FFAirCompNetwork
//
//  Created by chewyong on 2017/6/8.
//  Copyright © 2017年 isoftstone. All rights reserved.
//

#import "FFNetCacheManager.h"
#import "FFNetCacheConfig.h"
#import "FFNetworkCache.h"

@implementation FFNetCacheManager

/**
 * 设置缓存配置
 *
 *  @param config 缓存的url与时间的键值对 如:@{URL_REPORT_STATUS: @(15 * 60 * 1000)};
 */
+ (void)setCacheConfig:(NSDictionary *)config{
    
    [FFNetCacheConfig setCacheConfig:config cacheMaxNumber:1000];
}

/**
 * 根据URL删除缓存
 *
 *  @param urls 缓存的url数组;
 */
+ (BOOL)deleteNetCacheWithUrls:(NSArray *)urls{
    BOOL isSuccess = YES;
    for (NSString *url in urls) {
        isSuccess = [[FFNetworkCache sharedNetworkCache] deleteCacheWithURL:url requestBody:nil];
        if (!isSuccess) {
            break;
        }
    }
    
    return isSuccess;
}

/**
 * 清除所有缓存
 *
 */
+ (BOOL)deleteAllNetCache{
    return [[FFNetworkCache sharedNetworkCache] deleteAllCache];
}

@end
